package com.module.launcher.utils

import android.content.Context
import android.content.Intent
import android.widget.Toast
import com.module.app.ext.notNull
import com.module.launcher.view.MainActivity

private const val EXTRA_POSITION = "position"


fun Context?.startMain() {
    notNull({
        it.startActivity(Intent(this, MainActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startMain(position: Int) {
    notNull({
        var intent = Intent(this, MainActivity::class.java)
        intent.putExtra(EXTRA_POSITION, position)
        it.startActivity(intent)
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}
